PXC Documentation

PXC Home

L system

pre 1.18

Generate path using Lindenmayer system.

Node Data

Display name

L system

Internal name

Node_Path_L_System

Inheritances

Node_Processor
Node_Path_L_System

Inputs

Origin

vec2

Starting Position

vec3

Starting Position

rotation

Starting Angle

Properties

float

Length

rotation

Angle

3D

bool

3D

enum

Forward

rotation

Subangle

Rules

int

Iteration

text

Starting Rule

text

End Replacement

Dynamic Inputs

text

Name {_Idx}

text

Rule {_Idx}

Outputs

pathnode

Path


Create path from L-system.



Properties


Properties
LengthStep length.
AngleRotation angle.


Lindenmayer System


Lindenmayer Systems (L-system) is a system of drawing line using simple string. The line is drawn from a pointer (sometime called a turtle). The pointer is controlled by a rule containing letters or symbols.



Symbols


**F** Move forward and draw a line
**G** Move forward without drawing a line
**+** Rotate to the left
**-** Rotate to the right
**\[** Save current state in a stack.
**\]** Restore state from the top of the stack.
**\*** Rotate the secondary angle positively (3D).
**/** Rotate the secondary angle negatively (3D).

Move distance and turn angle are fixed.



Rules Generation


Rules are generated by repeatedly replace a letter with another letter(s). For example.


**X** Starting rule
**X > FX** Replace X by FX
**F > X+F** Replace F by X+F

Applying these rules the first time we will get:


**X** Starting rule
**FX** Apply the first rule replacing X with FX

The second iteration will be:


**FX** Result from the first iteration
F **FX** Applying the first rule replacing X with FX
**X+F** FX Applying the second rule replacing F with X+F

Notice that both rules are being applied at the same time, thus the seconds rule won't replace the letter replaced by the first rule. By repeating these operations many times we can construct more complex rule.



Random Rules


You can also apply multiple rules to the same letter to randomize rule selection.


**X > F+X** Replace X by F+X
**X > F-X** Replace X by F-X

These rules caused every X to has 50% chance to become F+X and 50% chance to become F-X.




Commit History


1.13.7
  • Introduced
1.21.3.006
  • Fix crash when trying to preview empty path output.

Related Links